from gg import *

testGraph = Graph()


"""

Generates Vertices for the entire graph and connects them to the ones adjacent to it.
It will create negative positon vertices #oops

"""

def genV(lMap):
    for row in range(len(lMap)):
        for column in range(len(lMap[row])):            
            temp = (column,row)

            #up,down,left,right
            testGraph.addEdge((temp),(temp[0],temp[1]+1),1)
            testGraph.addEdge((temp),(temp[0],temp[1]-1),1)
            testGraph.addEdge((temp),(temp[0]-1,temp[1]),1)
            testGraph.addEdge((temp),(temp[0]+1,temp[1]),1)

##            #diagonal movements
##            testGraph.addEdge((temp),(temp[0]-1,temp[1]-1),1)
##            testGraph.addEdge((temp),(temp[0]-1,temp[1]+1),1)
##            testGraph.addEdge((temp),(temp[0]+1,temp[1]-1),1)
##            testGraph.addEdge((temp),(temp[0]+1,temp[1]+1),1)
    


"""
Tests the iterative function of the graph object by printing out each Vertice

"""

def testThing():
    for v in testGraph:
        print(v)


def givePath(mappa,start,dest):
        genV(mappa)
        #testGraph.show()
        
        if start in testGraph and dest in testGraph:
            #print("We got there!")
            
            return testGraph.minPath(start,dest)



        
    
